package sdufe.lele.mybatisProvider;

import org.apache.ibatis.jdbc.SQL;
import sdufe.lele.model.Userinfo;

/**
 * Created by zhnh9 on 4/15/2017.
 */
public class CreateProvider {

    public String userInfoInsertSelective(final Userinfo userinfo) {
        return new SQL() {
            {
                INSERT_INTO("userinfo");
                if (userinfo.getUserage() != null) {
                    VALUES("userAge", "#{userage}");
                }
                if (userinfo.getUseremail() != null) {
                    VALUES("userEmail", "#{useremail}");
                }
                if (userinfo.getUserlevel() != null) {
                    VALUES("userLevel", "#{userlevel}");
                }
                if (userinfo.getUserpassword() != null) {
                    VALUES("userPassword", "#{userpassword}");

                }
                if (userinfo.getUsertele() != null) {
                    VALUES("userTele", "#{usertele}");
                }
                if (userinfo.getUsername()!=null){
                    VALUES("userName","#{username}");
                }
            }
        }.toString();

    }


}
